package com.meida.student.app.user.handler;

import com.meida.common.base.entity.EntityMap;
import com.meida.common.mybatis.interceptor.GetInterceptor;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.module.bus.client.entity.BusOrder;
import com.meida.module.bus.client.enums.PayTypeEnum;
import org.springframework.stereotype.Component;

@Component("BusOrderDetailPaySuccessHandler")
public class BusOrderDetailPaySuccessHandler implements GetInterceptor {


    @Override
    public void prepare(CriteriaQuery cq, EntityMap entityMap) {
        cq.clear();
        cq.select(BusOrder.class, "orderId", "orderNo", "orderAmount", "payableAmount", "payType", "createTime");
        cq.eq(BusOrder.class, "orderId");
    }

    @Override
    public void complete(CriteriaQuery cq, EntityMap map) {
        String payType = map.get("payType");
        PayTypeEnum payTypeEnum = PayTypeEnum.getByValue(payType);
        String payTypeDesc = payTypeEnum.getLabel();
        map.put("payTypeDesc", payTypeDesc);
    }


}
